package com.boot2.core;

import com.boot2.core.conf.CookieProperties;
import com.boot2.core.conf.UrlProperties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author zhangweilin
 * @date 2019/6/21 9:41
 * @Description: 系统配置
 */
@Component
@Configuration
@ConfigurationProperties(prefix = "sys")
@Data
public class SysProperties {

    private HttpProperties http=new HttpProperties();

    /**
     * 是否是以ajax,即前后分离的方式提供服务，默认为true
     */
    private Boolean isAjax = true;

//    private CoreProperties core;

    private CookieProperties cookie;

    /**
     * 系统临时目录
     */
    private String tmpPath="/tmp/boot2-core/";

    /**
     * url相关
     */
    private UrlProperties url;

    private Swagger2Properties swagger;


    @Data
    public static class HttpProperties{

        /**
         * 重试次数,默认次数为6
         */
        private int retryCount=6;
    }


    @Data
    public static class Swagger2Properties {

        private String tokenKey = "x-access-token";

        /**
         * swagger文档basePackage,支持ant风格路径，如sys.swagger.base-packages=com.bomi.**.controller,com.bomi.oper.controller,com.bomi.common.controller
         */
        private List<String> basePackages;
    }
}
